#pragma once
#include "precompiled.h"
#include "tbb/task.h"

namespace SoundManager{

	// Initialize the sound engine.
	void Init();

	// Load all of the sounds we will be playing.
	void LoadSounds( std::vector<std::string> paths,
		std::vector<std::string> keys );

	// Place an order to play a sound.
	void OrderASound( std::string key, bool loop );

	// Cleanup the sound engine.
	void Destroy();

	// Run the sound loop.
	void Run();
};

class SoundTBB: public tbb::task{
public:
	SoundTBB()
	{}
	tbb::task* execute(){
		SoundManager::Run();
		return NULL;
	}
};

// Call this to start the sound loop.
void static SoundTBB_Run(){
	SoundTBB& a = *new(tbb::task::allocate_root()) SoundTBB();
	tbb::task::spawn( a );
	return;
}